package qst.com.bacK.mapper;

import org.apache.ibatis.annotations.*;
import qst.com.bacK.pojo.entity.TestPersonnel;

import java.sql.SQLException;
import java.util.List;

/**
 * Author:   msh
 * Date:     2024/10/9 上午9:43
 * Description:
 */
public interface TestPersonnelMapper {
    @Insert("insert into mbti.testpersonnel(id,phone,gender,birthdate,email,team_id) values(#{id},#{phone},#{gender},#{birthDate},#{email},#{teamId})")
    void insert(TestPersonnel testPersonnel) throws SQLException;

    @Select("select * from mbti.testpersonnel where id = #{id}")
    TestPersonnel findById(Integer id);

    @Delete("delete from mbti.testpersonnel where id = #{id}")
    void delete(int id) throws SQLException;

    @Select("select * from mbti.testpersonnel where phone = #{phone}")
    TestPersonnel findByPhone(String phone) throws SQLException;

    @Update("update mbti.testpersonnel set phone = #{phone},gender = #{gender},birthdate = #{birthDate} where id = #{id}")
    void update(TestPersonnel s);

    @Select("select * from mbti.testpersonnel where team_id = #{tid}")
    List<TestPersonnel> findByTeamId(int tid) throws SQLException;

    List<TestPersonnel> query(@Param("teamId") int teamId,@Param("phone") String phone) throws SQLException;
}
